package com.sharedprint.system.menu.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sharedprint.system.menu.service.MenuInfoService;

/**
 *   菜单管理的控制器
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/api/menuInfo")
public class MenuInfoController {
	
	@Autowired
	private MenuInfoService menuInfoService;
	
	/**
	 * 用户登录
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryLeftMenuList")
	@ResponseBody
	public Map<String, Object> queryLeftMenuList(HttpServletRequest request) {
		Map<String, Object> searchMap = new HashMap<String, Object>();
		String token = request.getHeader("token");
		String userId = request.getHeader("userId");
		System.out.println("queryLeftMenuList..token="+token+",userId="+userId);
		List<Map<String, Object>> menuList = menuInfoService.findMenuInfoList(searchMap);
		Map<String, Object> resultMap = new HashMap<String, Object>();
		resultMap.put("success", "1");
		resultMap.put("menuList", menuList);
		return resultMap;
	}
}
